
mem = {}


def calc(nums, i):
    if i in mem:
        return mem[i]
    if i == len(nums) - 1:
        return 1
    max_len = 1
    for j in range(i+1, len(nums)):
        if nums[i] < nums[j]:
            max_len = max(max_len, calc(nums, j) + 1)
    return max_len


def len_of_LIS(nums):
    n = len(nums)
    ll = [1] * n
    for i in range(n)[::-1]:
        for j in range(i + 1, n):
            if nums[j] > nums[i]:
                ll[i] = max(ll[i], ll[j] + 1)
    return max(ll)


if __name__ == '__main__':
    a = list(map(int, input().split()))
    print(calc(a, 0))
    print(len_of_LIS(a))
